6.2 Visualising COVID-19 using maps

library(ggplot2)
library(maps)
library(ggthemes)
library(plotly)


d1 = read.csv("https://raw.githubusercontent.com/RamiKrispin/coronavirus-csv/master/coronavirus_dataset.csv")
d1 = d1[d1$type == "confirmed", ]

d2 = aggregate(d1$cases, by = list(Lat = d1$Lat, Long = d1$Long, Country.Region = d1$Country.Region, 
    Date = d1$date), FUN = sum)
colnames(d2)[5] = "cases"


world = map_data("world")
w1 = ggplot() + geom_polygon(data = world, aes(colour = region, x = long, y = lat, 
    group = group), fill = "white") + theme_map() + theme(legend.position = "none") + 
    scale_fill_brewer(palette = "Blues")
map <- w1 + geom_point(aes(x = Long, y = Lat, size = cases, colour = Country.Region), 
    data = d2, alpha = 1) + scale_size_continuous(range = c(2, 8)) + labs(title = "COVID-19 Confirmed Cases")
map

# interactive version
ggplotly(map)
Warning: `group_by_()` is deprecated as of dplyr 0.7.0.
Please use `group_by()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.